
var http=require("http");

var server=http.createServer(function (req,res) {

});

server.listen(3000);

server.on("error",function (err) {
      console.log(err);
});
server.on("listening",function () {
    console.log("服务器已启动！");
});

server.on("request",function (req,res) {
    console.log("客户端已接入！");
    res.writeHead(200,"OK",{
        "content-type":"text/html;charset=utf-8"
    });
   /* console.log(req);*/
   if(req.url==""||req.url=="/index"){

       res.write("<h1>这是首页！</h1>");
       res.end();
   }if(req.url=="/a"){
        res.write("<h1>这是a页！</h1>");
        res.end();
    }

});
